package com.shitou.shitouproduct.config;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * class detail:
 *
 * @author 石头人
 */
@SuppressWarnings("all")
@Configuration
@Component
public class RabbitMQConfit {

    /**
     * 商品库存释放
     */
    public final static String DECREMENT_SALECOUNT = "DECREMENT-SALECOUNT";
    /**
     * 插入或者更新时，将数据插入到elasticSearch中
     */
    public final static String INSERT_UPDATE_QUEUE = "INSERT-UPDATE-QUEUE";
    public final static String PRODUCT_SELL_QUEUE = "PRODUCT-SELL-QUEUE";
    public final static String PRODUCT_RELEASE_QUEUE = "PRODUCT-RELEASE-QUEUE";


    @Bean(DECREMENT_SALECOUNT)
    public Queue decrementQueue(){
        return new Queue(DECREMENT_SALECOUNT, true, false, false, null);
    }

    @Bean(INSERT_UPDATE_QUEUE)
    public Queue insertUpdateQueue(){
        return new Queue(INSERT_UPDATE_QUEUE, true, false, false, null);
    }
    @Bean(PRODUCT_SELL_QUEUE)
    public Queue sellQueue(){
        return new Queue(PRODUCT_SELL_QUEUE, true, false, false, null);
    }
    @Bean(PRODUCT_RELEASE_QUEUE)
    public Queue releaseQueue(){
        return new Queue(PRODUCT_RELEASE_QUEUE, true, false, false, null);
    }


}
